
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Vue 项目搭建 · 《前端学习笔记》</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="XiaoChen">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-ancre-navigation/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="初识 VueCli 3.html" />
    
    
    <link rel="prev" href="Web 前端环境搭建.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">前言</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Android</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../Android/Android 多包名打包应用.html">
            
                <a href="../Android/Android 多包名打包应用.html">
            
                    
                    Android 多包名打包应用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../Android/Android UI美化之 shape的使用及其属性总结.html">
            
                <a href="../Android/Android UI美化之 shape的使用及其属性总结.html">
            
                    
                    Android UI美化之 shape的使用及其属性总结
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">ReactNative</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../ReactNative/CodePush 热更新配置及使用.html">
            
                <a href="../ReactNative/CodePush 热更新配置及使用.html">
            
                    
                    CodePush 热更新配置及使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../ReactNative/已有Android工程 集成React Native.html">
            
                <a href="../ReactNative/已有Android工程 集成React Native.html">
            
                    
                    已有Android工程 集成React Native
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Egret</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../Egret/Egret 白鹭引擎参考资料.html">
            
                <a href="../Egret/Egret 白鹭引擎参考资料.html">
            
                    
                    Egret 白鹭引擎参考资料
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../Egret/EGER PRO.html">
            
                <a href="../Egret/EGER PRO.html">
            
                    
                    EGER PRO
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../Egret/Egret 寻路.html">
            
                <a href="../Egret/Egret 寻路.html">
            
                    
                    Egret 寻路
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">工具</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../Tools/homebrew 使用.html">
            
                <a href="../Tools/homebrew 使用.html">
            
                    
                    homebrew 使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../Tools/git 使用.html">
            
                <a href="../Tools/git 使用.html">
            
                    
                    git 使用
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">小程序</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../MiniApp/Atom 完美支持 WePY 小程序开发.html">
            
                <a href="../MiniApp/Atom 完美支持 WePY 小程序开发.html">
            
                    
                    Atom 完美支持 WePY 小程序开发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="../MiniApp/Atom 插件安装慢解决方案.html">
            
                <a href="../MiniApp/Atom 插件安装慢解决方案.html">
            
                    
                    Atom 插件安装慢解决方案
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Vue</li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="Web 前端环境搭建.html">
            
                <a href="Web 前端环境搭建.html">
            
                    
                    Web 前端环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="7.2" data-path="Vue 项目搭建.html">
            
                <a href="Vue 项目搭建.html">
            
                    
                    Vue 项目搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="初识 VueCli 3.html">
            
                <a href="初识 VueCli 3.html">
            
                    
                    初识 VueCli 3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="使用 VueCli 3.html">
            
                <a href="使用 VueCli 3.html">
            
                    
                    使用 VueCli 3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.5" data-path="VueCli 3 项目配置.html">
            
                <a href="VueCli 3 项目配置.html">
            
                    
                    VueCli 3 项目配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.6" data-path="../Vue3/Vue3探索.html">
            
                <a href="../Vue3/Vue3探索.html">
            
                    
                    初识 Vue3
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">微前端</li>
        
        
    
        <li class="chapter " data-level="8.1" data-path="../MicroApp/qiankun/">
            
                <a href="../MicroApp/qiankun/">
            
                    
                    qiankun
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">团队成长</li>
        
        
    
        <li class="chapter " data-level="9.1" data-path="../Team/Web前端开发规范.html">
            
                <a href="../Team/Web前端开发规范.html">
            
                    
                    开发规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.2" data-path="../Team/Web团队建设--npm私库搭建.html">
            
                <a href="../Team/Web团队建设--npm私库搭建.html">
            
                    
                    私库搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.3" data-path="../Team/Web团队建设--自定义脚手架.html">
            
                <a href="../Team/Web团队建设--自定义脚手架.html">
            
                    
                    脚手架搭建
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Vue 项目搭建</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-anchor"></i><ul><li><span class="title-icon "></span><a href="#vue-&#x9879;&#x76EE;&#x642D;&#x5EFA;"><b></b>Vue &#x9879;&#x76EE;&#x642D;&#x5EFA;</a></li><ul><li><span class="title-icon "></span><a href="#&#x73AF;&#x5883;&#x642D;&#x5EFA;"><b></b>&#x73AF;&#x5883;&#x642D;&#x5EFA;</a></li><li><span class="title-icon "></span><a href="#&#x521B;&#x5EFA;-vue-&#x9879;&#x76EE;"><b></b>&#x521B;&#x5EFA; Vue &#x9879;&#x76EE;</a></li><ul><li><span class="title-icon "></span><a href="#&#x9879;&#x76EE;&#x521B;&#x5EFA;"><b></b>&#x9879;&#x76EE;&#x521B;&#x5EFA;</a></li><li><span class="title-icon "></span><a href="#&#x542F;&#x52A8;&#x9879;&#x76EE;"><b></b>&#x542F;&#x52A8;&#x9879;&#x76EE;</a></li></ul><li><span class="title-icon "></span><a href="#&#x9879;&#x76EE;&#x6846;&#x67B6;&#x5B8C;&#x5584;"><b></b>&#x9879;&#x76EE;&#x6846;&#x67B6;&#x5B8C;&#x5584;</a></li><ul><li><span class="title-icon "></span><a href="#ui-&#x6846;&#x67B6;"><b></b>UI &#x6846;&#x67B6;</a></li><li><span class="title-icon "></span><a href="#&#x516C;&#x5171;&#x7EC4;&#x4EF6;&#x5C01;&#x88C5;"><b></b>&#x516C;&#x5171;&#x7EC4;&#x4EF6;&#x5C01;&#x88C5;</a></li></ul></ul></ul></div><a href="#vue-&#x9879;&#x76EE;&#x642D;&#x5EFA;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="vue-&#x9879;&#x76EE;&#x642D;&#x5EFA;"><a name="vue-&#x9879;&#x76EE;&#x642D;&#x5EFA;" class="anchor-navigation-ex-anchor" href="#vue-&#x9879;&#x76EE;&#x642D;&#x5EFA;"><i class="fa fa-link" aria-hidden="true"></i></a>Vue &#x9879;&#x76EE;&#x642D;&#x5EFA;</h1>
<h2 id="&#x73AF;&#x5883;&#x642D;&#x5EFA;"><a name="&#x73AF;&#x5883;&#x642D;&#x5EFA;" class="anchor-navigation-ex-anchor" href="#&#x73AF;&#x5883;&#x642D;&#x5EFA;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x73AF;&#x5883;&#x642D;&#x5EFA;</h2>
<p>&#x642D;&#x5EFA;&#x4E00;&#x4E2A; <code>Vue</code> &#x9879;&#x76EE;&#xFF0C;&#x4F60;&#x9700;&#x8981;&#x5177;&#x5907; <code>Vue</code> &#x6240;&#x9700;&#x57FA;&#x672C;&#x73AF;&#x5883;&#xFF0C;&#x5982;&#xFF1A;<code>node.js</code> &#x3001; <code>npm</code> &#x6216; <code>yarn</code> &#x4EE5;&#x53CA; <code>Vue-cli</code> &#x811A;&#x624B;&#x67B6;&#x5DE5;&#x5177;&#x3002;</p>
<p>&#x53EF;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#x68C0;&#x6D4B;&#x662F;&#x5426;&#x5DF2;&#x62E5;&#x6709;&#x4EE5;&#x4E0A;&#x73AF;&#x5883;&#xFF0C;&#x5DE5;&#x5177;--&#x547D;&#x4EE4;&#x884C;&#x3002;</p>
<pre><code>// &#x68C0;&#x6D4B; Node
node -v

// &#x68C0;&#x6D4B; Npm
npm -v

// Vue-cli
vue
</code></pre><p>&#x82E5;&#x6CA1;&#x6709;&#x4EE5;&#x4E0A;&#x73AF;&#x5883;&#xFF0C;&#x5B89;&#x88C5;&#x4E5F;&#x5F88;&#x7B80;&#x5355;&#x7684;&#xFF0C;&#x53EF;&#x4EE5;&#x67E5;&#x770B; <a href="http://note.youdao.com/noteshare?id=e70c3633db6a5a05f39d0adf97c7bbb1&amp;sub=EB3E0939AB224CA8B68A28C1E98999D1" target="_blank">Web &#x524D;&#x7AEF;&#x73AF;&#x5883;&#x642D;&#x5EFA;</a>
&#x8FD9;&#x7BC7;&#x6587;&#x7AE0;</p>
<blockquote>
<p>npm &#x9700;&#x8981;&#x5207;&#x6362;&#x81F3;&#x6DD8;&#x5B9D;&#x6E90;&#xFF0C;&#x7F51;&#x7EDC;&#x597D;&#x7684;&#x540C;&#x5B66;&#x5FFD;&#x7565;</p>
</blockquote>
<h2 id="&#x521B;&#x5EFA;-vue-&#x9879;&#x76EE;"><a name="&#x521B;&#x5EFA;-vue-&#x9879;&#x76EE;" class="anchor-navigation-ex-anchor" href="#&#x521B;&#x5EFA;-vue-&#x9879;&#x76EE;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x521B;&#x5EFA; Vue &#x9879;&#x76EE;</h2>
<h3 id="&#x9879;&#x76EE;&#x521B;&#x5EFA;"><a name="&#x9879;&#x76EE;&#x521B;&#x5EFA;" class="anchor-navigation-ex-anchor" href="#&#x9879;&#x76EE;&#x521B;&#x5EFA;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x9879;&#x76EE;&#x521B;&#x5EFA;</h3>
<p>&#x8FDB;&#x5165;&#x9700;&#x8981;&#x521B;&#x5EFA;&#x9879;&#x76EE;&#x7684;&#x76EE;&#x5F55;&#x7136;&#x540E;&#x6253;&#x5F00;&#x547D;&#x4EE4;&#x884C;&#x5DE5;&#x5177;&#x952E;&#x5165;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#x521B;&#x5EFA;&#x4F9D;&#x8D56;&#x4E8E; <code>Webpack</code> &#x7684; <code>Vue</code> &#x9879;&#x76EE;&#x3002;</p>
<pre><code>vue init webpack hello-vue
</code></pre><blockquote>
<p>hello-vue &#x4E3A;&#x9879;&#x76EE;&#x540D;&#x79F0;&#xFF0C;&#x53EF;&#x66F4;&#x6539;</p>
</blockquote>
<p>&#x7136;&#x540E;&#x56DE;&#x8F66;&#xFF0C;&#x4F1A;&#x51FA;&#x73B0;&#x4E00;&#x7CFB;&#x5217;&#x9009;&#x9879;&#x8BA9;&#x4F60;&#x9009;&#x62E9;&#xFF0C;&#x8FD9;&#x91CC;&#x53EF;&#x6839;&#x636E;&#x9879;&#x76EE;&#x5B9E;&#x9645;&#x60C5;&#x51B5;&#x81EA;&#x884C;&#x9009;&#x62E9;&#x662F;&#x5426;&#x6DFB;&#x52A0;&#xFF0C;&#x5982;&#xFF1A;&#x82E5;&#x9879;&#x76EE;&#x4E0D;&#x9700;&#x8981; <code>vue-router</code>
&#x6A21;&#x5757;&#x53EF;&#x9009;&#x62E9;&#x4E0D;&#x5B89;&#x88C5;&#xFF0C;&#x952E;&#x5165; <code>n</code> &#x56DE;&#x8F66;&#x5373;&#x53EF;&#x3002;</p>
<p>&#x547D;&#x4EE4;&#x8DD1;&#x5B8C;&#x540E;&#x5373;&#x53EF;&#x6210;&#x529F;&#x521B;&#x5EFA;&#x9879;&#x76EE;&#x3002;</p>
<h3 id="&#x542F;&#x52A8;&#x9879;&#x76EE;"><a name="&#x542F;&#x52A8;&#x9879;&#x76EE;" class="anchor-navigation-ex-anchor" href="#&#x542F;&#x52A8;&#x9879;&#x76EE;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x542F;&#x52A8;&#x9879;&#x76EE;</h3>
<p>&#x542F;&#x52A8;&#x9879;&#x76EE;&#x65B9;&#x5F0F;&#x76F4;&#x63A5;&#x8FDB;&#x5165;&#x9879;&#x76EE;&#x76EE;&#x5F55;&#xFF0C;&#x7136;&#x540E;&#x547D;&#x4EE4;&#x884C;&#x952E;&#x5165; <code>npm start</code> &#x5373;&#x53EF;&#xFF0C;&#x8FD9;&#x65F6;&#x5019;&#x53EF;&#x6D4F;&#x89C8;&#x5668;&#x6253;&#x5F00; <code>http://localhost:8080</code> &#x67E5;&#x770B;&#x754C;&#x9762;&#x3002;</p>
<blockquote>
<p>&#x82E5;&#x7AEF;&#x53E3;&#x88AB;&#x5360;&#x7528;&#x53EF;&#x4FEE;&#x6539;&#x9879;&#x76EE;&#x4E2D;&#x7684; <code>config</code> &#x76EE;&#x5F55;&#x4E0B; <code>index.js</code> &#x5185; <code>port</code> &#x5B57;&#x6BB5;&#x503C;</p>
</blockquote>
<h2 id="&#x9879;&#x76EE;&#x6846;&#x67B6;&#x5B8C;&#x5584;"><a name="&#x9879;&#x76EE;&#x6846;&#x67B6;&#x5B8C;&#x5584;" class="anchor-navigation-ex-anchor" href="#&#x9879;&#x76EE;&#x6846;&#x67B6;&#x5B8C;&#x5584;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x9879;&#x76EE;&#x6846;&#x67B6;&#x5B8C;&#x5584;</h2>
<h3 id="ui-&#x6846;&#x67B6;"><a name="ui-&#x6846;&#x67B6;" class="anchor-navigation-ex-anchor" href="#ui-&#x6846;&#x67B6;"><i class="fa fa-link" aria-hidden="true"></i></a>UI &#x6846;&#x67B6;</h3>
<h4 id="mint-ui"><a name="mint-ui" class="anchor-navigation-ex-anchor" href="#mint-ui"><i class="fa fa-link" aria-hidden="true"></i></a>mint-ui</h4>
<p>&#x6B64;&#x5904;&#x6839;&#x636E;&#x9879;&#x76EE;&#x9700;&#x6C42;&#x9009;&#x62E9;&#xFF0C; PC &#x7AEF;&#x7528; <a href="http://element.eleme.io/#/zh-CN" target="_blank">element</a>
&#x79FB;&#x52A8;&#x7AEF;&#x7528; <a href="http://mint-ui.github.io/#!/zh-cn" target="_blank">mint-ui</a> , &#x6B64;&#x5904;&#x4EE5; <code>mint-ui</code> &#x4E3A;&#x4F8B;&#xFF0C; &#x9996;&#x5148;&#x5B89;&#x88C5;&#x4F9D;&#x8D56;</p>
<pre><code>npm i mint-ui -S
</code></pre><p>&#x5B89;&#x88C5;&#x5B8C;&#x6210;&#x540E;&#x5C31;&#x53EF;&#x4EE5;&#x5728;&#x9879;&#x76EE;&#x4E2D;&#x5F15;&#x5165;&#x4F7F;&#x7528;&#x4E86;&#x3002;</p>
<p>&#x8FD9;&#x91CC;&#x7684;&#x5F15;&#x5165;&#x65B9;&#x5F0F;&#x6709;&#x4E24;&#x79CD;&#xFF1A;</p>
<ul>
<li>&#x5B8C;&#x6574;&#x5F15;&#x5165;</li>
<li>&#x6309;&#x9700;&#x5F15;&#x5165;</li>
</ul>
<h5 id="&#x5B8C;&#x6574;&#x5F15;&#x5165;"><a name="&#x5B8C;&#x6574;&#x5F15;&#x5165;" class="anchor-navigation-ex-anchor" href="#&#x5B8C;&#x6574;&#x5F15;&#x5165;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5B8C;&#x6574;&#x5F15;&#x5165;</h5>
<p>&#x5728; <code>main.js</code> &#x4E2D;&#x5199;&#x5165;&#x4EE5;&#x4E0B;&#x5185;&#x5BB9;&#xFF1A;</p>
<pre><code>import Vue from &apos;vue&apos;
import MintUI from &apos;mint-ui&apos;
import &apos;mint-ui/lib/style.css&apos;
import App from &apos;./App.vue&apos;

Vue.use(MintUI)

new Vue({
    el: &apos;#app&apos;,
    components: { App }
})
</code></pre><blockquote>
<p>&#x6B64;&#x79CD;&#x5F15;&#x5165;&#x65B9;&#x5F0F;&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;&#x6837;&#x5F0F;&#x6587;&#x4EF6;&#x9700;&#x8981;&#x5355;&#x72EC;&#x5F15;&#x5165;&#x3002;</p>
</blockquote>
<h5 id="&#x6309;&#x9700;&#x5F15;&#x5165;"><a name="&#x6309;&#x9700;&#x5F15;&#x5165;" class="anchor-navigation-ex-anchor" href="#&#x6309;&#x9700;&#x5F15;&#x5165;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6309;&#x9700;&#x5F15;&#x5165;</h5>
<p>&#x6709;&#x65F6;&#x5019;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x7528;&#x5230;&#x7684;&#x7EC4;&#x4EF6;&#x5E76;&#x4E0D;&#x591A;&#xFF0C;&#x90A3;&#x4E48;&#x6211;&#x4EEC;&#x53EF;&#x80FD;&#x5C31;&#x9700;&#x8981;&#x7528;&#x5230;&#x6309;&#x9700;&#x5F15;&#x5165;&#x7684;&#x65B9;&#x5F0F;&#x4E86;&#x3002;</p>
<p>&#x9996;&#x5148;&#xFF0C;&#x5B89;&#x88C5; babel-plugin-component&#xFF1A;</p>
<pre><code>npm install babel-plugin-component -D
</code></pre><p>&#x7136;&#x540E;&#xFF0C;&#x5C06; <code>.babelrc</code> &#x6587;&#x4EF6;&#x5185;&#x5BB9;&#x4FEE;&#x6539;&#x4E3A;&#xFF1A;</p>
<pre><code>{
    &quot;presets&quot;: [
    [&quot;es2015&quot;, { &quot;modules&quot;: false }]
    ],
    &quot;plugins&quot;: [[&quot;component&quot;, [
    {
        &quot;libraryName&quot;: &quot;mint-ui&quot;,
        &quot;style&quot;: true
    }
    ]]]
}
</code></pre><p>&#x7136;&#x540E;&#x5728; <code>main.js</code> &#x4E2D;&#x5F15;&#x5165;&#x6240;&#x9700;&#x8981;&#x7684;&#x7EC4;&#x4EF6;&#x5982; <code>Header</code>&#xFF1A;</p>
<pre><code>import Vue from &apos;vue&apos;
import { Header } from &apos;mint-ui&apos;
import App from &apos;./App.vue&apos;

Vue.component(Header.name, Header)
// &#x6B64;&#x5904;&#x4E5F;&#x53EF;&#x5199;&#x4E3A;
// Vue.use(Header)

new Vue({
    el: &apos;#app&apos;,
    components: { App }
})
</code></pre><p>&#x7136;&#x540E;&#x5728;&#x7EC4;&#x4EF6;&#x4E2D;&#x5C31;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x8BE5;&#x7EC4;&#x4EF6;&#x4E86;</p>
<h4 id="sass"><a name="sass" class="anchor-navigation-ex-anchor" href="#sass"><i class="fa fa-link" aria-hidden="true"></i></a>sass</h4>
<p>&#x5B89;&#x88C5;sass&#x7684;&#x4F9D;&#x8D56;&#x5305;</p>
<pre><code>npm install --save-dev sass-loader
//sass-loader&#x4F9D;&#x8D56;&#x4E8E;node-sass
npm install --save-dev node-sass
</code></pre><p>&#x5B89;&#x88C5;&#x5B8C;&#x6210;&#x540E;&#x5728; <code>build</code> &#x6587;&#x4EF6;&#x5939;&#x4E0B;&#x7684; <code>webpack.base.conf.js</code> &#x7684; <code>rules</code> &#x90E8;&#x5206;&#x6DFB;&#x52A0;&#x914D;&#x7F6E;</p>
<pre><code>{
    test: /\.sass$/,
    loaders: [&apos;style&apos;, &apos;css&apos;, &apos;sass&apos;]
}
</code></pre><p>&#x7136;&#x540E;&#x6D4B;&#x8BD5;&#x662F;&#x5426;&#x5B89;&#x88C5;&#x6210;&#x529F;</p>
<p>&#x5C06; <code>App.vue</code> &#x6587;&#x4EF6;&#x5185; <code>style</code> &#x6807;&#x7B7E;&#x6DFB;&#x52A0; <code>scss</code> &#x6807;&#x8BB0;&#xFF0C;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code>&lt;style lang=&quot;scss&quot;&gt;

    ...

&lt;/style&gt;
</code></pre><p>&#x7136;&#x540E;&#x4FEE;&#x6539; <code>style</code> &#x6807;&#x7B7E;&#x5185;&#x7684;&#x6837;&#x5F0F;&#xFF0C;&#x4F8B;&#x5982;&#x4FEE;&#x6539;&#x80CC;&#x666F;&#x8272;&#xFF1A;</p>
<pre><code>&lt;style lang=&quot;scss&quot;&gt;

    $backGround:#FF0000;
    body {
        background: $backGround;
    }

&lt;/style&gt;
</code></pre><p>&#x67E5;&#x770B;&#x754C;&#x9762;&#x663E;&#x793A;&#x6548;&#x679C;&#xFF0C;&#x82E5;&#x663E;&#x793A;&#x4E3A;&#x7EA2;&#x8272;&#x5219;&#x5B89;&#x88C5;&#x6210;&#x529F;</p>
<h4 id="vuex"><a name="vuex" class="anchor-navigation-ex-anchor" href="#vuex"><i class="fa fa-link" aria-hidden="true"></i></a>Vuex</h4>
<p><a href="https://vuex.vuejs.org/zh/" target="_blank">Vuex</a> &#x662F;&#x4E00;&#x4E2A;&#x4E13;&#x4E3A; <code>Vue.js</code> &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5F00;&#x53D1;&#x7684;&#x72B6;&#x6001;&#x7BA1;&#x7406;&#x6A21;&#x5F0F;&#x3002;</p>
<h3 id="&#x516C;&#x5171;&#x7EC4;&#x4EF6;&#x5C01;&#x88C5;"><a name="&#x516C;&#x5171;&#x7EC4;&#x4EF6;&#x5C01;&#x88C5;" class="anchor-navigation-ex-anchor" href="#&#x516C;&#x5171;&#x7EC4;&#x4EF6;&#x5C01;&#x88C5;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x516C;&#x5171;&#x7EC4;&#x4EF6;&#x5C01;&#x88C5;</h3>
<h4 id="&#x7F51;&#x7EDC;&#x8BF7;&#x6C42;"><a name="&#x7F51;&#x7EDC;&#x8BF7;&#x6C42;" class="anchor-navigation-ex-anchor" href="#&#x7F51;&#x7EDC;&#x8BF7;&#x6C42;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7F51;&#x7EDC;&#x8BF7;&#x6C42;</h4>
<h4 id="log"><a name="log" class="anchor-navigation-ex-anchor" href="#log"><i class="fa fa-link" aria-hidden="true"></i></a>log</h4>
<h4 id="&#x8DEF;&#x7531;"><a name="&#x8DEF;&#x7531;" class="anchor-navigation-ex-anchor" href="#&#x8DEF;&#x7531;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x8DEF;&#x7531;</h4>
<h4 id="&#x7248;&#x672C;&#x63A7;&#x5236;"><a name="&#x7248;&#x672C;&#x63A7;&#x5236;" class="anchor-navigation-ex-anchor" href="#&#x7248;&#x672C;&#x63A7;&#x5236;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7248;&#x672C;&#x63A7;&#x5236;</h4>
<footer class="page-footer"><span class="copyright">Copyright &amp; copy zengqing.top 2023 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x66F4;&#x65B0;&#x4E8E;&#xFF1A;
2023-03-25 20:54:40
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="Web 前端环境搭建.html" class="navigation navigation-prev " aria-label="Previous page: Web 前端环境搭建">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="初识 VueCli 3.html" class="navigation navigation-next " aria-label="Next page: 初识 VueCli 3">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Vue 项目搭建","level":"7.2","depth":1,"next":{"title":"初识 VueCli 3","level":"7.3","depth":1,"path":"Vue2/初识 VueCli 3.md","ref":"./Vue2/初识 VueCli 3.md","articles":[]},"previous":{"title":"Web 前端环境搭建","level":"7.1","depth":1,"path":"Vue2/Web 前端环境搭建.md","ref":"./Vue2/Web 前端环境搭建.md","articles":[]},"dir":"ltr"},"config":{"plugins":["expandable-chapters","code","pageview-count","chapter-fold","expandable-chapters-small","tbfed-pagefooter","hide-element","ancre-navigation"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright & copy zengqing.top 2023","modify_label":"该文件更新于：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"code":{"copyButtons":true},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"pageview-count":{},"ancre-navigation":{"showLevel":true,"associatedWithSummary":true,"mode":"float","printLog":false,"multipleH1":true,"float":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"expandable-chapters-small":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"XiaoChen","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"《前端学习笔记》","language":"zh-hans","gitbook":"*","description":"个人学习笔记，记录学习过程中的点点滴滴"},"file":{"path":"Vue2/Vue 项目搭建.md","mtime":"2023-03-25T12:54:40.910Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2023-03-26T04:06:26.355Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

